import Vue from "vue";
import VueRouter from "vue-router";

import componentsRoutes from "./models/components-routes"
import pluginsRoutes from "./models/plugins-routes"
import vueFeaturesRoutes from "./models/vue-features-routes"

Vue.use(VueRouter);
// 指定了相同的webpackChunkName，会合并打包成y一个js文件
// 指定了webpackPreload:true，路由会预加载，会在首屏加载
// 指定了webpackPrefetch:true，路由会按需加载，会在空闲加载, 只有在config.plugins.delete('prefetch')的情况才会使用
const routes = [
	{
		path: "/",
		redirect: "/login",
	},
	{
		path: "/login",
		name: "login",
		component: () => import( /* webpackChunkName: 'login' */ "@/views/login"),
	},
	{
		path: "/main",
		name: "main",
		component: () => import( /* webpackChunkName: 'main' */ "@/views/main"),
		redirect: { name: 'home' },
		children: [
			{
				path: "/home",
				name: "home",
				component: () => import( /* webpackChunkName: 'home' */ "@/views/home"),
			},
			...componentsRoutes,
			...pluginsRoutes,
			...vueFeaturesRoutes,
			{
				path: "/main/theme_message",
				// path: "theme_message",
				name: "theme_message",
				component: () => import( /* webpackChunkName: 'theme_message' */ "@/views/theme_message"),
			},
			{
				path: "other_message",
				name: "other_message",
				component: () => import( /* webpackChunkName: 'other_message' */ "@/views/other_message"),
			},
			{
				path: "render",
				name: "render",
				component: () => import( /* webpackChunkName: 'render_index' */ "@/views/render/index.vue"),
				children: [{
					path: "jsx",
					name: "jsx",
					component: () => import( /* webpackChunkName: 'render_jsx' */ "@/views/render/render_jsx.vue"),
				},
				{
					path: "fun",
					name: "fun",
					component: () => import( /* webpackChunkName: 'render_fn' */ "@/views/render/render_fn.vue"),
				},
				{
					path: "form",
					name: "form",
					component: () => import( /* webpackChunkName: 'render_form' */ "@/views/render/render_form.vue"),
				},
				]
			},

			{
				path: "download_message",
				name: "download_message",
				component: () => import( /* webpackChunkName: 'download_message' */ "@/views/download_message"),
			},
			{
				path: "bpmn_message",
				name: "bpmn_message",
				component: () => import( /* webpackChunkName: 'bpmn_message' */ "@/views/bpmn_message/index.vue"),
				redirect: '/main/bpmn_message/default_bpmn',
				children: [{
					path: "default_bpmn",
					name: "default_bpmn",
					component: () => import( /* webpackChunkName: 'default_bpmn' */ "@/views/bpmn_message/default_bpmn.vue"),
				},
				{
					path: "custom_palette_contextPad",
					name: "custom_palette_contextPad",
					component: () => import( /* webpackChunkName: 'custom_palette_contextPad' */ "@/views/bpmn_message/custom_palette_contextPad.vue"),
				},
				{
					path: "custom_palette_contextPad_all",
					name: "custom_palette_contextPad_all",
					component: () => import( /* webpackChunkName: 'custom_palette_contextPad_all' */ "@/views/bpmn_message/custom_palette_contextPad_all.vue"),
				},
				{
					path: "properties-panel-extension",
					name: "properties-panel-extension",
					component: () => import( /* webpackChunkName: 'properties-panel-extension' */ "@/views/bpmn_message/properties-panel-extension.vue"),
				},



				]
			},


		],
	},];

const router = new VueRouter({
	mode: 'history',
	routes,
	    base: '/vue3',

});


export default routes;
